package com.zdxf.client.controller;

import com.zdxf.client.domain.SystemInfoDO;
import org.springframework.web.bind.annotation.*;


@RestController
public class ClientController {

    /**
     * 获取cpu信息
     *
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/getCpuInfo")
    public Object getCpuInfo() throws Exception {
        SystemInfoDO res = new SystemInfoDO();
        System.printlnCpuInfo(res);
        return res;
    }

    /**
     * 获取内存信息
     *
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/getMemInfo")
    public Object getMemInfo() throws Exception {
        SystemInfoDO res = new SystemInfoDO();
        System.MemInfo(res);
        return res;
    }

    /**
     * 获取网络流量信息
     *
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/getNetInfo")
    public Object getNetInfo() throws Exception {
        SystemInfoDO res = new SystemInfoDO();
        System.NetInfo(res);
        return res;
    }

    /**
     * 获取硬盘信息
     *
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/getDiskInfo")
    public Object getDiskInfo() throws Exception {
        SystemInfoDO res = new SystemInfoDO();
        System.getWinDiskUsage(res);
        System.OperatingInfo(res);
        System.CpuLoadInfo(res);
        return res;
    }

    /**
     * 获取系统信息
     *
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/getSysInfo")
    public Object getSysInfo() throws Exception {
        SystemInfoDO res = new SystemInfoDO();
        System.setSysInfo(res);
        return res;
    }
    /**
     * 获取除网络之外的全部信息
     *
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/getAllInfo")
    public Object getAllInfo() throws Exception {
        SystemInfoDO res = new SystemInfoDO();
        System.getAllInfo(res);
        return res;
    }

    /**
     * 获取进程信息
     *
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/OperatingInfo")
    public Object OperatingInfo() throws Exception {
        SystemInfoDO res = new SystemInfoDO();
        System.OperatingInfo(res);
        return res;
    }
    /**
     * 获取负载信息
     *
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/CpuLoadInfo")
    public Object CpuLoadInfo() throws Exception {
        SystemInfoDO res = new SystemInfoDO();
        System.CpuLoadInfo(res);
        return res;
    }
}
